package com.twq.basic.bigpicture

/**
 * Created by tangweiqun on 2017/11/27.
 * 使用Sets和Maps
 */
object Step10 {
  def main(args: Array[String]): Unit = {
    //不变Set
    val jetSet = Set("Boeing", "Airbus")
    val newSet = jetSet + "Lear"
    println(newSet.contains("Cessna"))

    //可变Set
    import scala.collection.mutable
    val movieSet = mutable.Set("Hitch", "Poltergeist")
    movieSet += "Shrek"
    println(movieSet)

    //不变的Map
    val romanNumeral = Map(
      1 -> "I", 2 -> "II", 3 -> "III", 4 -> "IV", 5 -> "V"
    )
    val anotherMap = romanNumeral + (9 -> "test")
    println(romanNumeral(4))

    //可变Map
    import scala.collection.mutable
    val treasureMap = mutable.Map[Int, String]()
    treasureMap += (1 -> "Go to island.")
    treasureMap += (2 -> "Find big X on ground.")
    treasureMap += (3 -> "Dig.")
    println(treasureMap(2))
  }
}
